home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 February
/
EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso
/
progs
/
editor
/
frexxed
/
fpl
/
ccalc.fpl
< prev
next >
Wrap
Text File
|
1995-08-22
|
866b
|
38 lines
string history_list[20];
int history_items;
export int cCalcresult;
export void cCalc()
{
string expression;
int list=history_items;
if(!list) {
list=1;
history_list[0]=" ";
}
if(RequestWindow("Expression",
"C-style expression", "a", &history_list, &expression,
list)) {
if(!ExecuteString(sprintf("cCalcresult = %s;", expression))) {
Request(sprintf("%s =\n\nDec: %d\nHex: %X\nBin: %b\nOct: %o",
expression,
cCalcresult, cCalcresult, cCalcresult, cCalcresult),
"Result", "Wow!");
}
if(history_items++) {
int a;
if(history_items>20)
history_items--;
a = history_items-1;
while(a>0) {
history_list [a] = history_list [a-1];
a--;
}
}
history_list [0] = expression;
}
}